package com.polaris.live.widget

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
import com.bumptech.glide.Glide
import com.polaris.live.databinding.WidgetRoomDrawerTagBinding
import com.polaris.live.resp.back_resp.DisplayUserBean
import com.polaris.live.utils.image.ImageUtils

/**
 * 侧拉列表房间标识
 *
 * @author Created by 半仙 on 2024/11/27/027 11:58
 */
class RoomDrawerTagView(context: Context, attributeSet: AttributeSet) :
    LinearLayout(context, attributeSet) {
    private val mBinding = WidgetRoomDrawerTagBinding.inflate(LayoutInflater.from(context), this)

    /**
     * 设置状态，通过用户基本信息
     */
    fun setState(displayUserBean: DisplayUserBean) {
        mBinding.apply {
            Glide.with(ivRoomState)
                .load(ImageUtils.imgPath(displayUserBean.roomSymbol?.icon))
                .into(ivRoomState)
            tvRoomState.text = displayUserBean.roomSymbol?.name ?: ""

        }
    }

}